package com.dfdchem.imd.kaiwu.activity.base;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

import com.dfdchem.imd.kaiwu.util.Log;

public class ActivityObserver implements LifecycleObserver {

    private static final String TAG = "ActivityObserver";

    // 使用注解  @OnLifecycleEvent 来表明该方法需要监听指定的生命周期事件
    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    public void onCreate() {

        Log.d(TAG, "ActivityObserver:  --------   onCreate" );
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void onStart() {

        Log.d(TAG, "ActivityObserver:  --------   onStart" );
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    public void onResume() {
        Log.d(TAG, "ActivityObserver:  --------   onResume" );
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void onStop() {

        Log.d(TAG, "ActivityObserver:  --------   onStop" );
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    public void onPause() {

        Log.d(TAG, "ActivityObserver: -------   onPause");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    public void onDestroy() {

        Log.d(TAG, "ActivityObserver:  --------   onDestroy" );
    }

}
